{include file="common/pc/header" title="自定义设置" /}

<form class="layui-form" action="" method="post">

    {foreach name="configGroups" item="configGroup" key="groupName"}
    <div class="layui-card">
        <div class="layui-card-header">{$groupName}</div>
        <div class="layui-card-body">
            {foreach name="configGroup" item="configItem"}
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">{$configItem.title}</label>
                <div class="layui-input-inline layui-input-inline-long">
                    {switch name="configItem.type"}
                    {case value="image"}
                    {d:up type="image" field="$configItem.name"
                    value="$configItem.value"
                    w="$configItem.width" h="$configItem.height"
                    }浏览图片{/d:up}
                    {php}
                    if(!isset($configItem['tip'])) {
                    $configItem['tip'] = "最佳尺寸：".$configItem['width']." * ".$configItem['height'];
                    }
                    {/php}
                    {/case}
                    {case value="radio"}
                    {foreach name="configItem.options" item="opName" key="opKey"}
                    <input type="radio" name="{$configItem.name}" value="{$opKey}" title="{$opName}" {if
                           condition="$opKey == $configItem.value" } checked="" {/if} />
                    {/foreach}
                    {/case}
                    {case value="textarea"}
                    <textarea class="layui-textarea" name="{$configItem.name}">{$configItem.value}</textarea>
                    {/case}
                    {default /}
                    <input class="layui-input" name="{$configItem.name}" value="{$configItem.value}"/>
                    {/switch}
                </div>
                <div class="layui-form-mid layui-word-aux">{$configItem.tip}</div>
            </div>
            {/foreach}
        </div>
    </div>
    {/foreach}
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="submit">保存</button>
        </div>
    </div>
</form>

<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form;
    });
</script>